/* components */
import { 
  SettingGPTViewContentTitle,
  SettingGPTViewContentSubTitle,
} from "@src/modules/setting/gpt/components";
/* enum */
import ComponentNameEnum from '@model/enum/ComponentNameEnum'
import { SettingGPTQuestionTypeEnum } from '@src/modules/setting/gpt/model'
/* hooks */
import { useSettingListPage, useSettingListTable } from '@src/modules/setting/gpt/hooks'
/* model */
import Page from '@model/Page'
/* vue */
import { defineComponent, PropType, Ref, ref } from 'vue'
/* types */
import { AIChatRobotItemType } from '@src/component/business/BizChatPanel/chat/types'
import Column from '@model/types/Column'
/* util */
import { uuid } from 'pub-bbx-utils'
import { isFalsy } from "@src/util/type";

enum SettingGPTSettingViewRobotOperateEventEnum {
  Add = 'add'
}

export default defineComponent({
  name: ComponentNameEnum.SettingGPTSettingViewRobotOperate,
  props: {
    isShowAdd: {
      type: Boolean,
      default: true
    },
    onAdd: {
      type: Function
    }
  },
  setup(props, { emit }) {
    
  },
  data() {
    return {
      key: uuid()
    }
  },
  computed: {
    title(): string {
      return '机器人列表'
    },
    subTitle(): string {
      return '添加不同的机器人，让AI为不同的企业场景提供个性化的服务'
    },
  },
  watch: {
    
  },
  methods: {
    onAddHandler() {
      this.$emit(SettingGPTSettingViewRobotOperateEventEnum.Add)
    },
    renderAddButton() {
      
      if (isFalsy(this.isShowAdd)) {
        return
      }
      
      return (
        <div class="setting-gpt-setting-view-robot-operate-button">
          <el-button
            type="primary"
            onClick={this.onAddHandler}
          >
            添加机器人
          </el-button>
        </div>
      )
    }
  },
  render() {
    return (
      <div class={ComponentNameEnum.SettingGPTSettingViewRobotOperate}>
        
        <SettingGPTViewContentTitle
          title={this.title}
        >
        </SettingGPTViewContentTitle>
        
        <SettingGPTViewContentSubTitle
          title={this.subTitle}
        >
        </SettingGPTViewContentSubTitle>
        
        { this.renderAddButton() }
        
      </div>
    )
  }
})